package com.hope.onlinestudy.activity.main

import android.view.View
import com.hope.onlinestudy.R
import com.hope.onlinestudy.activity.forgetpass.ForgetPassActivity
import com.hope.onlinestudy.activity.login.LoginActivity
import com.hope.onlinestudy.activity.register.RegisterActivity
import com.hope.onlinestudy.mvp.MVPBaseActivity
import com.umeng.analytics.MobclickAgent
import com.umeng.commonsdk.UMConfigure
import kotlinx.android.synthetic.main.activity_main.*
import me.jessyan.retrofiturlmanager.RetrofitUrlManager
import org.jetbrains.anko.startActivity

/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */
class MainActivity :
    MVPBaseActivity<MainContract.View, MainPresenter>(), View.OnClickListener,
    MainContract.View {
    override fun getLayoutView(): Int {
        return R.layout.activity_main
    }

    override fun onClick(v: View?) {
        when (v?.id) {
            R.id.btnLogin -> {
                startActivity<LoginActivity>()
                finish()
            }
            R.id.btnRegister -> startActivity<RegisterActivity>()
            R.id.tvForget -> startActivity<ForgetPassActivity>()
        }
    }

    override fun initData() {
        UMConfigure.init(
            applicationContext,
            "5be24f06f1f5567c2e0000ba",
            "study",
            UMConfigure.DEVICE_TYPE_PHONE,
            ""
        )
        MobclickAgent.openActivityDurationTrack(false)
        UMConfigure.setLogEnabled(true)

        btnLogin.setOnClickListener(this)
        btnRegister.setOnClickListener(this)
        tvForget.setOnClickListener(this)
    }
}